﻿using System;
using System.Data;
using System.Collections;
using CE.Database;


/// <summary>
/// Summary description for tblTransferDataBKI

/// Table Name : [tblTransferDataBKI]
/// Created By : CX
/// Created Date : Wednesday, April 20, 2011
/// </summary>
/// 
namespace CE.Transfer
{

    public class TransferBKIDB
    {
        public TransferBKIDB()
        {	//TODO: Add constructor logic here

        }

        public Int64 Insert(TransferBKI transfer)
		{
			MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "[sprocInsert]";			          

			SortedList _sPara = new SortedList();
			
			#region Parameter			
            _sPara.Add("@Id", transfer.id);
            _sPara.Add("@user_id", transfer.user_id);
            _sPara.Add("@que_no", transfer.que_no);
            _sPara.Add("@que_seq", transfer.que_seq);
            _sPara.Add("@ref_no", transfer.ref_no);
            _sPara.Add("@eff_date", transfer.eff_date);
            _sPara.Add("@sum_ins", transfer.sum_ins);
            _sPara.Add("@risk", transfer.risk);
            _sPara.Add("@garage", transfer.garage);
            _sPara.Add("@car_type", transfer.car_type);
            _sPara.Add("@car_use", transfer.car_use);
            _sPara.Add("@make", transfer.make);
            _sPara.Add("@model", transfer.model);
            _sPara.Add("@car_name", transfer.car_name);
            _sPara.Add("@car_year", transfer.car_year);
            _sPara.Add("@ncb", transfer.ncb);
            _sPara.Add("@deduct", transfer.deduct);
            _sPara.Add("@deduct_lib", transfer.deduct_lib);
            _sPara.Add("@drv_flag", transfer.drv_flag);
            _sPara.Add("@drv_year", transfer.drv_year);
            _sPara.Add("@comp_req", transfer.comp_req);
            _sPara.Add("@package_name", transfer.package_name);
            _sPara.Add("@package_code", transfer.package_code);
            _sPara.Add("@package_seq", transfer.package_seq);
            _sPara.Add("@plan_seq", transfer.plan_seq);
            _sPara.Add("@sub_plan", transfer.sub_plan);
            _sPara.Add("@vol_gross", transfer.vol_gross);
            _sPara.Add("@vol_total", transfer.vol_total);
            _sPara.Add("@comp_gross", transfer.comp_gross);
            _sPara.Add("@comp_total", transfer.comp_total);
            _sPara.Add("@chassis", transfer.chassis);
            _sPara.Add("@engine", transfer.engine);
            _sPara.Add("@plate_no", transfer.plate_no);
            _sPara.Add("@plate_jw", transfer.plate_jw);
            _sPara.Add("@drv1_title", transfer.drv1_title);
            _sPara.Add("@drv1_name", transfer.drv1_name);
            _sPara.Add("@drv1_address1", transfer.drv1_address1);
            _sPara.Add("@drv1_address2", transfer.drv1_address2);
            _sPara.Add("@drv1_province", transfer.drv1_province);
            _sPara.Add("@drv1_amphur", transfer.drv1_amphur);
            _sPara.Add("@drv1_zip", transfer.drv1_zip);
            _sPara.Add("@drv1_home_tel", transfer.drv1_home_tel);
            _sPara.Add("@drv1_office_tel", transfer.drv1_office_tel);
            _sPara.Add("@drv1_mobile_tel", transfer.drv1_mobile_tel);
            _sPara.Add("@drv1_fax_tel", transfer.drv1_fax_tel);
            _sPara.Add("@drv1_occupation", transfer.drv1_occupation);
            _sPara.Add("@drv1_birth", transfer.drv1_birth);
            _sPara.Add("@drv2_title", transfer.drv2_title);
            _sPara.Add("@drv2_name", transfer.drv2_name);
            _sPara.Add("@drv2_address1", transfer.drv2_address1);
            _sPara.Add("@drv2_address2", transfer.drv2_address2);
            _sPara.Add("@drv2_province", transfer.drv2_province);
            _sPara.Add("@drv2_amphur", transfer.drv2_amphur);
            _sPara.Add("@drv2_zip", transfer.drv2_zip);
            _sPara.Add("@drv2_home_tel", transfer.drv2_home_tel);
            _sPara.Add("@drv2_office_tel", transfer.drv2_office_tel);
            _sPara.Add("@drv2_mobile_tel", transfer.drv2_mobile_tel);
            _sPara.Add("@drv2_fax_tel", transfer.drv2_fax_tel);
            _sPara.Add("@drv2_occupation", transfer.drv2_occupation);
            _sPara.Add("@drv2_birth", transfer.drv2_birth);
            _sPara.Add("@cus1_title", transfer.cus1_title);
            _sPara.Add("@cus1_name", transfer.cus1_name);
            _sPara.Add("@cus1_address1", transfer.cus1_address1);
            _sPara.Add("@cus1_address2", transfer.cus1_address2);
            _sPara.Add("@cus1_province", transfer.cus1_province);
            _sPara.Add("@cus1_amphur", transfer.cus1_amphur);
            _sPara.Add("@cus1_zip", transfer.cus1_zip);
            _sPara.Add("@cus1_home_tel", transfer.cus1_home_tel);
            _sPara.Add("@cus1_office_tel", transfer.cus1_office_tel);
            _sPara.Add("@cus1_mobile_tel", transfer.cus1_mobile_tel);
            _sPara.Add("@cus1_fax_tel", transfer.cus1_fax_tel);
            _sPara.Add("@cus1_occupation", transfer.cus1_occupation);
            _sPara.Add("@cus1_birth", transfer.cus1_birth);
            _sPara.Add("@cus2_title", transfer.cus2_title);
            _sPara.Add("@cus2_name", transfer.cus2_name);
            _sPara.Add("@cus2_address1", transfer.cus2_address1);
            _sPara.Add("@cus2_address2", transfer.cus2_address2);
            _sPara.Add("@cus2_province", transfer.cus2_province);
            _sPara.Add("@cus2_amphur", transfer.cus2_amphur);
            _sPara.Add("@cus2_zip", transfer.cus2_zip);
            _sPara.Add("@cus2_home_tel", transfer.cus2_home_tel);
            _sPara.Add("@cus2_office_tel", transfer.cus2_office_tel);
            _sPara.Add("@cus2_mobile_tel", transfer.cus2_mobile_tel);
            _sPara.Add("@cus2_fax_tel", transfer.cus2_fax_tel);
            _sPara.Add("@cus2_occupation", transfer.cus2_occupation);
            _sPara.Add("@cus2_birth", transfer.cus2_birth);
            _sPara.Add("@ben_name", transfer.ben_name);
            _sPara.Add("@ben_tel", transfer.ben_tel);
            _sPara.Add("@sent_type", transfer.sent_type);
            _sPara.Add("@sent_to", transfer.sent_to);
            _sPara.Add("@drv1_id", transfer.drv1_id);
            _sPara.Add("@drv1_id_type", transfer.drv1_id_type);
            _sPara.Add("@drv2_id", transfer.drv2_id);
            _sPara.Add("@drv2_id_type", transfer.drv2_id_type);
            _sPara.Add("@cus1_id", transfer.cus1_id);
            _sPara.Add("@cus1_id_type", transfer.cus1_id_type);
            _sPara.Add("@cus2_id", transfer.cus2_id);
            _sPara.Add("@cus2_id_type", transfer.cus2_id_type);
            _sPara.Add("@fr_date", transfer.fr_date);
            _sPara.Add("@to_date", transfer.to_date);
            _sPara.Add("@sent_name", transfer.sent_name);
            _sPara.Add("@sent_address", transfer.sent_address);
            _sPara.Add("@sent_tel", transfer.sent_tel);
            _sPara.Add("@color", transfer.color);
            _sPara.Add("@body", transfer.body);
            _sPara.Add("@cus1_gender", transfer.cus1_gender);
            _sPara.Add("@cus2_gender", transfer.cus2_gender);
            _sPara.Add("@drv1_gender", transfer.drv1_gender);
            _sPara.Add("@drv2_gender", transfer.drv2_gender);
            _sPara.Add("@body_code", transfer.body_code);
            _sPara.Add("@color_code", transfer.color_code);
            _sPara.Add("@print_cus", transfer.print_cus);
            _sPara.Add("@drv1_license_no", transfer.drv1_license_no);
            _sPara.Add("@drv1_license_type", transfer.drv1_license_type);
            _sPara.Add("@drv1_jw_license_no", transfer.drv1_jw_license_no);
            _sPara.Add("@drv1_frm", transfer.drv1_frm);
            _sPara.Add("@drv1_expire", transfer.drv1_expire);
            _sPara.Add("@drv1_age", transfer.drv1_age);
            _sPara.Add("@drv2_license_no", transfer.drv2_license_no);
            _sPara.Add("@drv2_license_type", transfer.drv2_license_type);
            _sPara.Add("@drv2_jw_license_no", transfer.drv2_jw_license_no);
            _sPara.Add("@drv2_frm", transfer.drv2_frm);
            _sPara.Add("@drv2_expire", transfer.drv2_expire);
            _sPara.Add("@drv2_age", transfer.drv2_age);

            #endregion
			
            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
		}

        public bool Update()
        {
            return true;
        }

        public bool Delete(Int64 id)
		{
			MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "[sprocDelete]";
			
			SortedList _sPara = new SortedList();	
			

            #region Parameter
            //_sPara.Add("@ID", id);
            //_sPara.Add("@ID2", id2);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result > 0;			
		}


    }


}



